package com.itcjb.springboot.controller;

import com.itcjb.springboot.entity.JsonResult;
import com.itcjb.springboot.entity.User;
import com.itcjb.springboot.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/** @author chenjiebin */
@RestController
@RequestMapping("/user")
public class UserController {
    @Autowired
    private UserService userService;

    @GetMapping("/getUserByName/{username}")
    public JsonResult<User> getUserByName(@PathVariable String username) {
        return new JsonResult<>(userService.getUserByName(username));
    }
}
